package com.tcs.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.tcs.dao.UserDao;
import com.tcs.model.Permission;
import com.tcs.model.User;

@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {

	@Resource
	private UserDao userDao;

	public User login(String username, String password) {
		return userDao.login(username, password);
	}

	public void addUser(User user) {
		userDao.saveUser(user);
	}

	@Override
	public List<Permission> listPermissions() {
		return userDao.listPermissions();
	}

	public Permission getPermission(int ID) {
		return userDao.getPermission(ID);
	}

	public List<User> listUsers() {
		return userDao.listUsers();
	}

	@Override
	public User getUser(int id) {
		return userDao.getUser(id);
	}

}
